const path = require('path')
class HomeCtrol {
	index(ctx) {
		ctx.body = '<h1>这是主页</h1>'
	}
	async upload(ctx) {
		const file = ctx.request.files.file
		const basename = path.basename(file.path)
		// console.log(`${ctx.origin}/uploads/${basename}`)
		ctx.body = {
			code: 0,
			url: `${ctx.origin}/uploads/${basename}`
		}
	}
}

module.exports = new HomeCtrol()
